home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 29 / PC Gamer IT CD 29 1-2.iso / MEDIA / UPDATE.DXR / Internal_2_UtilityHandlers.ls < prev    next >
Encoding:
Text File  |  1997-12-01  |  3.6 KB  |  158 lines

  1. on openP
  2.   global DBfact, TBfact
  3.   set DBfact to xtra("V12Dbe")
  4.   set TBfact to xtra("V12Table")
  5. end
  6.  
  7. on createDB
  8.   global DBfact
  9.   set gDb to new(DBfact, the pathName & "UPDATE.DB", "cr", "imagine")
  10.   mCreateTable(gDb, "update")
  11.   put mCreateField(gDb, "update", "appname", "String", 255)
  12.   put mCreateField(gDb, "update", "longname", "String", 255)
  13.   put mCreateField(gDb, "update", "description", "String", 2000)
  14.   put mCreateField(gDb, "update", "fileLoc", "String", 255)
  15.   put mCreateField(gDb, "update", "contact", "String", 400)
  16.   put mCreateField(gDb, "update", "url", "String", 255)
  17.   put mCreateIndex(gDb, "update", "appIdx", "d", "appname", "a")
  18.   put mBuild(gDb)
  19.   set gDb to 0
  20. end
  21.  
  22. on openDB
  23.   global DBfact, TBfact, gDb, gTB
  24.   set gDb to new(DBfact, the pathName & "UPDATE.DB", "ReadWrite", "imagine")
  25.   set gTB to new(TBfact, mGetRef(gDb), "update")
  26. end
  27.  
  28. on Import
  29.   global DBfact, TBfact, gDb, gTB
  30.   put mImportFile(gTB, the pathName & "updates.txt", TAB, RETURN)
  31. end
  32.  
  33. on getOne
  34.   global gTB
  35.   put mGetField(gTB, "name", 1, 2)
  36. end
  37.  
  38. on listIt
  39.   global gTB
  40.   put EMPTY into field "theList"
  41.   set n to mSelectCount(gTB)
  42.   repeat with i = 1 to n
  43.     put mGetField(gTB, "category", "category") after field "theList"
  44.     mGoNext(gTB)
  45.   end repeat
  46. end
  47.  
  48. on closeP
  49.   global gTB, gDb
  50.   set gTB to 0
  51.   set gDb to 0
  52. end
  53.  
  54. on CreateIt
  55.   cursor(4)
  56.   openP()
  57.   createDB()
  58.   openDB()
  59.   Import()
  60.   closeP()
  61.   cursor(-1)
  62. end
  63.  
  64. on ImportIt
  65.   openDB()
  66.   Import()
  67.   closeP()
  68. end
  69.  
  70. on showSelection
  71.   global gTB
  72.   cursor(4)
  73.   set n to mSelectCount(gTB)
  74.   put n into field "totalCount"
  75.   set temp to mGetPosition(gTB)
  76.   mGoFirst(gTB)
  77.   put EMPTY into field "zList"
  78.   set dummy to EMPTY
  79.   repeat with i = 1 to n
  80.     set nm to mGetField(gTB, "appname")
  81.     put nm & RETURN after dummy
  82.     mGoNext(gTB)
  83.   end repeat
  84.   put dummy into field "zList"
  85.   mGo(gTB, temp)
  86.   updateDisplay()
  87.   cursor(-1)
  88. end
  89.  
  90. on updateDisplay
  91.   global gTB
  92.   set i to mGetPosition(gTB)
  93.   set the foreColor of field "zlist" to 255
  94.   set the foreColor of line i of field "zlist" to 19
  95.   put mGetField(gTB, "appname") into field "appname"
  96.   put mGetField(gTB, "longname") into field "longname"
  97.   put mGetField(gTB, "description") into field "description"
  98.   put mGetField(gTB, "fileLoc") into field "fileLoc"
  99.   put mGetField(gTB, "contact") into field "contact"
  100.   put mGetField(gTB, "url") into field "url"
  101. end
  102.  
  103. on domSelectCount
  104.   global gTB
  105.   put mSelectCount(gTB) into field "totalCount"
  106. end
  107.  
  108. on CheckError errCode, msg
  109.   global gDb
  110.   if errCode <> 0 then
  111.     if objectp(gDb) then
  112.       set errTxt to mError(gDb, errCode)
  113.     else
  114.       set errText to "unknown error"
  115.     end if
  116.     alert("Error" && errCode && "(" & errTxt & ") occured at" && msg)
  117.   end if
  118. end
  119.  
  120. on TrackClick
  121.   set spriteNum to the clickOn
  122.   set offCast to the castNum of sprite spriteNum
  123.   set onCast to offCast + 1
  124.   set the castNum of sprite spriteNum to onCast
  125.   updateStage()
  126.   repeat while the mouseDown
  127.     if rollOver(spriteNum) then
  128.       set the castNum of sprite spriteNum to onCast
  129.     else
  130.       set the castNum of sprite spriteNum to offCast
  131.     end if
  132.     updateStage()
  133.   end repeat
  134.   set the castNum of sprite spriteNum to offCast
  135.   updateStage()
  136.   return rollOver(spriteNum)
  137. end
  138.  
  139. on getdrive
  140.   set curpath to the moviePath
  141.   set olddelimiter to the itemDelimiter
  142.   set the itemDelimiter to "\"
  143.   set drive to item 1 of curpath & "\"
  144.   set the itemDelimiter to olddelimiter
  145.   return drive
  146. end
  147.  
  148. on restartMe
  149.   global DBfact, TBfact
  150.   clearGlobals()
  151.   openXLib(the pathName & "xtras:V12Dbe")
  152.   openXLib(the pathName & "xtras:V12Table")
  153.   set DBfact to xtra("V12Dbe")
  154.   set TBfact to xtra("V12Table")
  155.   set the visible of sprite 47 to 0
  156.   put "All Shareware" into field "fld"
  157. end
  158.